authApp.value('page','datafill'); 
authApp.controller("teacherDataController",function($scope,$http,$cookies,$getQueryString){
	if($getQueryString("isfill")=="2"){
		$scope.schoolId=$getQueryString("schoolId");
		$scope.isHideAction=true;
	}
	$scope.savaInfo=function(type){
		var confirmHtml="是否保存";
		if(type=="sub"){
			confirmHtml="是否提交";
		}
		if(window.confirm(confirmHtml)){
			var methodUrl=apis.insertTeacherData1;
			var methodStatus="0";
			var alertMsg="保存成功";
			if($getQueryString("isfill")=="1"){
				methodUrl=apis.updateTeacherData1;
			}else if($getQueryString("isfill")=="0"){
				methodUrl=apis.insertTeacherData1;
			}else{
				$scope.isHideAction=true;
			}
			if(type=="su"){
				methodStatus="0";
				alertMsg="保存成功";
			}else if(type=="sub"){
				methodStatus="1";
				alertMsg="提交成功";
			}
			$http({
				method:'post',
				url:methodUrl,
				data:{
					'fulltimeTeacherNum':$scope.fulltimeTeacherNum,
					'schoolSeriesNum':$scope.schoolSeriesNum,
					'schoolPrivatdozentNum':$scope.schoolPrivatdozentNum,
					'professionalFulltimeTeacherNum':$scope.professionalFulltimeTeacherNum,
					'professionalSeriesNum':$scope.professionalSeriesNum,
					'professionalPrivatdozentNum':$scope.professionalPrivatdozentNum,
					'higherEducationFulltimeTeacherNum':$scope.higherEducationFulltimeTeacherNum,
					'doctoralTeachersNum':$scope.doctoralTeachersNum,
					'masterTeachersNum':$scope.masterTeachersNum,
					'readingDoctoralTeachersNum':$scope.readingDoctoralTeachersNum,
					'readingMasterTeachersNum':$scope.readingMasterTeachersNum,
					'masterRatio':$scope.masterRatio,
					'highProfessionalEducationFulltimeTeacherNum':$scope.highProfessionalEducationFulltimeTeacherNum,
					'doctoralDegreeNum':$scope.doctoralDegreeNum,
					'readingMasterNum':$scope.readingMasterNum,
					'seniorFulltimeTeacherNum':$scope.seniorFulltimeTeacherNum,
					'schoolProfessorNum':$scope.schoolProfessorNum,
					'schoolAssociateProfessorNum':$scope.schoolAssociateProfessorNum,
					'professionalHigherFulltimeTeacherNum':$scope.professionalHigherFulltimeTeacherNum,
					'professionalAssociateProfessorNum':$scope.professionalAssociateProfessorNum,
					'professionalProfessorNum':$scope.professionalProfessorNum,
					'professionalLecturerNum':$scope.professionalLecturerNum,
					'oneyearKindergartenTeachersNum':$scope.oneyearKindergartenTeachersNum,
					'noyearKindergartenTeachersNum':$scope.noyearKindergartenTeachersNum,
					'excellentTeachersNum':$scope.excellentTeachersNum,
					'status':methodStatus,
				},
			}).success(function(response){
				if(response.code=="000000"){
					alert(alertMsg);
					location.href="../datafill.html";
				}else{
					alert(response.errorMsg);
				}
			})
		}
	}
	
	$scope.getInfo=function(){
		$http({
			method:'get',
			url:apis.queryTeacherDataBySchoolId2,
			params:{'schoolid':$scope.schoolId},
		}).success(function(response){
			if(response.code=="000000"){
				$scope.fulltimeTeacherNum=response.data.fulltimeTeacherNum;
				$scope.schoolSeriesNum=response.data.schoolSeriesNum;
				$scope.schoolPrivatdozentNum=response.data.schoolPrivatdozentNum;
				$scope.professionalFulltimeTeacherNum=response.data.professionalFulltimeTeacherNum;
				$scope.professionalSeriesNum=response.data.professionalSeriesNum;
				$scope.professionalPrivatdozentNum=response.data.professionalPrivatdozentNum;
				$scope.higherEducationFulltimeTeacherNum=response.data.higherEducationFulltimeTeacherNum;
				$scope.doctoralTeachersNum=response.data.doctoralTeachersNum;
				$scope.masterTeachersNum=response.data.masterTeachersNum;
				$scope.readingDoctoralTeachersNum=response.data.readingDoctoralTeachersNum;
				$scope.readingMasterTeachersNum=response.data.readingMasterTeachersNum;
				$scope.masterRatio=response.data.masterRatio;
				$scope.highProfessionalEducationFulltimeTeacherNum=response.data.highProfessionalEducationFulltimeTeacherNum;
				$scope.doctoralDegreeNum=response.data.doctoralDegreeNum;
				$scope.readingDoctoralNum=response.data.readingDoctoralNum;
				$scope.masterDegreeNum=response.data.masterDegreeNum;
				$scope.readingMasterNum=response.data.readingMasterNum;
				$scope.seniorFulltimeTeacherNum=response.data.seniorFulltimeTeacherNum;
				$scope.schoolProfessorNum=response.data.schoolProfessorNum;
				$scope.schoolAssociateProfessorNum=response.data.schoolAssociateProfessorNum;
				$scope.professionalHigherFulltimeTeacherNum=response.data.professionalHigherFulltimeTeacherNum;
				$scope.professionalAssociateProfessorNum=response.data.professionalAssociateProfessorNum;
				$scope.professionalProfessorNum=response.data.professionalProfessorNum;
				$scope.professionalLecturerNum=response.data.professionalLecturerNum;
				$scope.oneyearKindergartenTeachersNum=response.data.oneyearKindergartenTeachersNum;
				$scope.noyearKindergartenTeachersNum=response.data.noyearKindergartenTeachersNum;
				$scope.excellentTeachersNum=response.data.excellentTeachersNum;
				$scope.remark1=response.data.remark.split("#")[0];
				$scope.remark2=response.data.remark.split("#")[1];
				$scope.remark3=response.data.remark.split("#")[2];
				$scope.remark4=response.data.remark.split("#")[3];
				$scope.remark5=response.data.remark.split("#")[4];
				$scope.remark6=response.data.remark.split("#")[5];
				$scope.remark7=response.data.remark.split("#")[6];
				$scope.remark8=response.data.remark.split("#")[7];
				$scope.remark9=response.data.remark.split("#")[8];
				$scope.remark10=response.data.remark.split("#")[9];
				$scope.remark11=response.data.remark.split("#")[10];
				$scope.remark12=response.data.remark.split("#")[11];
				$scope.remark13=response.data.remark.split("#")[12];
				$scope.remark14=response.data.remark.split("#")[13];
				$scope.remark15=response.data.remark.split("#")[14];
				$scope.remark16=response.data.remark.split("#")[15];
				$scope.remark17=response.data.remark.split("#")[16];
				$scope.remark18=response.data.remark.split("#")[17];
				$scope.remark19=response.data.remark.split("#")[18];
				$scope.remark20=response.data.remark.split("#")[19];
				$scope.remark21=response.data.remark.split("#")[20];
				$scope.remark22=response.data.remark.split("#")[21];
				$scope.remark23=response.data.remark.split("#")[22];
				$scope.remark24=response.data.remark.split("#")[23];
				$scope.remark25=response.data.remark.split("#")[24];
				$scope.remark26=response.data.remark.split("#")[25];
				$scope.remark27=response.data.remark.split("#")[26];
			}
		})
	}
	if($getQueryString("isfill")=="1"||$getQueryString("isfill")=="2"){
		$scope.getInfo();
	}
	
})